/*
 * Copyright 2010 Mttang.com All right reserved. This software is the
 * confidential and proprietary information of Mttang.com ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Mttang.com.
 */
package com.mttang.sys.biz.service.support;

import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.mttang.framework.core.service.AbstractService;
import com.mttang.sys.biz.service.DepartmentService;
import com.mttang.sys.dto.TreeDTO;
import com.mttang.sys.integration.dao.DepartmentDAO;
import com.mttang.util.SysBeanConstant;

/**
 * 类MenuServiceImpl.java的实现描述：TODO 类实现描述 
 * @author acc 2010-6-1 上午11:23:50
 */
public class DepartmentServiceImpl extends AbstractService implements DepartmentService {

    private Log logger = LogFactory.getLog(getClass());
    /* (non-Javadoc)
     * @see com.mttang.sys.biz.service.MenuService#delete(com.mttang.sys.dto.MenuDTO)
     */
    
    
    
    /**
     * 部门接口人查询
     */
    @Override
    public Map getDepLeaderByDepId(Map paraMap){
        DepartmentDAO dao=(DepartmentDAO) context.getBean(SysBeanConstant.DAO_DEPARTMENT);
        return dao.getDepLeaderByDepId(paraMap);
    }
    
    
    //部门列表查询
    @Override
    public List<Map> queryDepAll(Map data){
        DepartmentDAO dao=(DepartmentDAO) context.getBean(SysBeanConstant.DAO_DEPARTMENT);
        return dao.queryDepAll(data);
    }
    //部门接口人指定
    @Override
    public String addLeaderToDep(Map data){
        DepartmentDAO dao=(DepartmentDAO) context.getBean(SysBeanConstant.DAO_DEPARTMENT);
        return dao.addLeaderToDep(data);
    }
    
    //部门接口人修改
    @Override
    public String updateLeaderToDep(Map data){
        DepartmentDAO dao=(DepartmentDAO) context.getBean(SysBeanConstant.DAO_DEPARTMENT);
        return dao.updateLeaderToDep(data);
    }
    //部门信息查询(包括接口人)
    @Override
    public Map getDepInfo(Map paraMap){
        DepartmentDAO dao=(DepartmentDAO) context.getBean(SysBeanConstant.DAO_DEPARTMENT);
        return dao.getDepInfo(paraMap);
    }
    
    @Override
    public void delDept(Map<Object, Object> paraMap) {

    	if (logger.isInfoEnabled()) {
            logger.info("---DepartmentServiceImpl---delDept-- Begin----");
        }
        
    	DepartmentDAO dao=(DepartmentDAO) context.getBean(SysBeanConstant.DAO_DEPARTMENT);
        dao.delDept(paraMap);
        
//      //写日志
//		SystemLogService systemLogService = (SystemLogServiceImpl)context.getBean(SysBeanConstant.SERVICE_SYSTEMLOG);
//		systemLogService.addLog(logMap);
        
        if (logger.isInfoEnabled()) {
            logger.info("---DepartmentServiceImpl---delDept---End---");
        }
         
    }

    /* (non-Javadoc)
     * @see com.mttang.sys.biz.service.MenuService#findById(java.lang.Integer)
     */
    @Override
    public List<TreeDTO> qryDept(Map<Object, Object> paraMap) {

    	if (logger.isInfoEnabled()) {
            logger.info("---DepartmentServiceImpl---qryDept--Begin--");
        }
    	
        DepartmentDAO dao=(DepartmentDAO) context.getBean(SysBeanConstant.DAO_DEPARTMENT);
        return dao.qryDept(paraMap);
        
    }
    
    @Override
    public TreeDTO qryDeptById(int deptId){
        DepartmentDAO dao=(DepartmentDAO) context.getBean(SysBeanConstant.DAO_DEPARTMENT);
        return dao.qryDeptById(deptId);
    }

    /* (non-Javadoc)
     * @see com.mttang.sys.biz.service.MenuService#insert(com.mttang.sys.dto.MenuDTO)
     */
    @Override
    public void addDept(Map<Object, Object> paraMap) {
        if (logger.isInfoEnabled()) {
        	logger.info("---DepartmentServiceImpl---addDept--Begin--");
        }
        DepartmentDAO dao=(DepartmentDAO) context.getBean(SysBeanConstant.DAO_DEPARTMENT);
        dao.addDept(paraMap);
        
//      //写日志
//		SystemLogService systemLogService = (SystemLogServiceImpl)context.getBean(SysBeanConstant.SERVICE_SYSTEMLOG);
//		systemLogService.addLog(logMap);
		
        if (logger.isInfoEnabled()) {
        	logger.info("---DepartmentServiceImpl---addDept--End--");
        }
    }

    /* (non-Javadoc)
     * @see com.mttang.sys.biz.service.MenuService#update(com.mttang.sys.dto.MenuDTO)
     */
    @Override
    public void mdfDept(Map<Object, Object> paraMap) {
        
    	 if (logger.isInfoEnabled()) {
         	logger.info("---DepartmentServiceImpl---mdfDept--End--");
         }
        
        DepartmentDAO dao=(DepartmentDAO) context.getBean(SysBeanConstant.DAO_DEPARTMENT);
        dao.mdfDept(paraMap);
        
//        //写日志
//		SystemLogService systemLogService = (SystemLogServiceImpl)context.getBean(SysBeanConstant.SERVICE_SYSTEMLOG);
//		systemLogService.addLog(logMap);
		
        if (logger.isInfoEnabled()) {
        	logger.info("---DepartmentServiceImpl---mdfDept--End--");
        }
    }

}
